//
//  HoroscopeListViewController.m
//  HoroscopeApp
//
//  Created by qinjiandong on 2018/7/12.
//  Copyright © 2018年 qinjiandong. All rights reserved.
//

#import "HoroscopeListViewController.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>

@interface HoroscopeListViewController ()
@property (nonatomic,strong)NSArray *signDataSorce;
@property(nonatomic,assign)NSInteger signStyle;

@end
//image 11111100-11111111
//buttonn 1111110-1111121
@implementation HoroscopeListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //255 208 65
    self.navigationItem.hidesBackButton = YES;
//     [self.tableView  setSeparatorColor:[UIColor colorWithRed:255.0/255 green:208.0/255.0 blue:65.0/255.0 alpha:1]];

    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;
    
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
    self.signDataSorce = @[@"Aquarius",@"Pisces",@"Aries",@"Taurus",@"Gemini",@"Cancer",@"Leo",@"Virgo",@"Libra",@"Scorpio",@"Sagittarius",@"Capricorn"];
}
-(void)viewDidLayoutSubviews{
    [super viewDidLayoutSubviews];
    
   
   NSDictionary *dict = [[NSUserDefaults standardUserDefaults]objectForKey:@"userDefaults"];
   self.signStyle = [[dict objectForKey:@"selectedStyle"] integerValue];
    
    //selectedStyle
    for (int i = 0; i < 12; i++) {
        UIImageView *imageView = [self.view viewWithTag:(11111100+i)];
//        imageView.layer.cornerRadius
        NSString *imageName = [NSString stringWithFormat:@"%@_%ld",self.signDataSorce[i],(long)self.signStyle];
        [imageView setImage:[UIImage imageNamed:imageName]];
    }
}

#pragma mark - Table view data source


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return 138;
    
}

- (IBAction)didSelectedSignAction:(UIButton *)sender {

   NSMutableDictionary *infoDict =[NSMutableDictionary dictionaryWithDictionary:[[NSUserDefaults standardUserDefaults]objectForKey:@"userDefaults"]];
    NSInteger index = sender.tag%10;
    [infoDict setObject:self.signDataSorce[index] forKey:@"siginInfo"];
    [[NSUserDefaults standardUserDefaults]setObject:infoDict forKey:@"userDefaults"];
    [[NSUserDefaults standardUserDefaults]synchronize];
    
    [self performSegueWithIdentifier:@"HoroscopeDetailInfoController" sender:self];

}
- (IBAction)didGoToInfoPageAction:(UIBarButtonItem *)sender {
    
    UIStoryboard *loginStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
    UITableViewController *NCloginNC = [loginStoryboard instantiateViewControllerWithIdentifier:@"HoroscopeInfoViewController"];
    self.navigationController.viewControllers = @[NCloginNC,self];
    
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)payAction{
    
    [[SRSubscriptionModel shareKit] restoreSubscriptions];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
